package com.juzi.xunhuan_while;

public class WhileDemo2 {
    public static void main(String[] args) {
        //需求：珠峰高度为8848860 纸张厚度为0.1 折叠纸张直到不低于珠峰高度 求 折叠几次
        //1、定义变量 记录珠峰高度 纸张厚度
        double peakHeight = 8848860;
        double paperThickness = 0.1;

        //3、定义一个变量用于记录纸张折叠次数
        int count = 0;

        //2、定义一个while循环 控制纸张 进行折叠
        while (paperThickness < peakHeight){
            //让纸张的厚度多一倍
            paperThickness *= 2;
            count ++;
        }
        System.out.println("折叠次数:" + count);
        System.out.println("纸张最终厚度:" + paperThickness);
        System.out.println("------------------");

        if (peakHeight<peakHeight){
            paperThickness *= 2;

        }else {
            System.out.println(paperThickness);
        }

        System.out.println("---------------------");

        int c = 0;
        for (double i = 0.1; i <= 8848860 ; i *= 2) {
            c++;
            System.out.println(i);
            System.out.println(c);
        }
    }
}
